package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.PersonnelService;
import com.yixun.qfbao.apidto.GetDevPartnerPageReqDto;
import com.yixun.qfbao.apidto.GetDevPartnerPageResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetDevPartnerPageReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Date 2021/1/21
 * @Author qi.liu
 */
@Service("getDevNewPartnerPageHander")
public class GetDevNewPartnerPageHander extends CommonAbstractHander {

    private static Logger logger= LoggerFactory.getLogger(GetDevNewPartnerPageHander.class);
    @Autowired
    PersonnelService personnelService;

    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        GetDevPartnerPageReqVo req = (GetDevPartnerPageReqVo)reqDto;
        GetDevPartnerPageReqDto reqDto1 = req.getParams();
        BaseResponseDTO<GetDevPartnerPageResDto> res = new BaseResponseDTO<GetDevPartnerPageResDto>();
        GetDevPartnerPageResDto resDto = new GetDevPartnerPageResDto();
        try{
            resDto = personnelService.getDevNewPartnerPage(reqDto1);
        } catch (Exception e) {
            logger.error("GetDevNewPartnerPageHander error: {}", e);
            resDto.setResult(ResultEnum.FAIL.getNo());
            resDto.setResultMsg("获取本部人员失败!");
        }
        res.setResData(resDto);
        res.setResult(resDto.getResult());
        return res;
    }
}
